const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const MonacoLocalesPlugin = require('monaco-editor-locales-plugin');
const path = require('path');

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  productionSourceMap: false,
  chainWebpack: config => {
    config.optimization.minimize(false);
  },
  configureWebpack: {
    plugins: [
      new MonacoWebpackPlugin(),
      new MonacoLocalesPlugin({
        languages: ["es", "zh-cn"],
        defaultLanguage: "zh-cn",
      })
    ]
  },
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
        appId: 'com.evil.toolbox',
        productName: "toolbox",
        artifactName: 'toolbox_setup_${version}.${ext}',
        win: {
          icon: 'public/icon.png',
          target: {
            target: 'nsis',
            arch: ['x64']
          }
        },
        publish: {
          /* provider: 'github',
           repo: 'image',
           owner: 'evil171',
           token: '3afae2d5492699f7d513d9bb772665402860f858',
           releaseType: 'release',
           publishAutoUpdate: true*/
          provider: 'generic',
          url: 'http://10.10.3.29/app/'
        },
        nsis: {
          oneClick: false,
          perMachine: true,
          allowElevation: true,
          allowToChangeInstallationDirectory: true,
          createDesktopShortcut: true,
          runAfterFinish: true,
          installerIcon: "./build/icons/icon.ico",
          uninstallerIcon: "./build/icons/icon.ico"
        }
      }
    }
  }
};
